package com.note.common.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
 * 协作会话实体类
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("collaboration_session")
@Schema(description = "协作会话实体")
public class CollaborationSession extends BaseEntity {
    
    /**
     * 会话ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "会话ID", example = "1")
    private Long id;
    
    /**
     * 笔记ID
     */
    @TableField("note_id")
    @Schema(description = "关联笔记ID", example = "1")
    private Long noteId;
    
    /**
     * 创建者ID
     */
    @TableField("creator_id")
    @Schema(description = "创建者ID", example = "1")
    private Long creatorId;
    
    /**
     * 会话名称
     */
    @TableField("name")
    @Schema(description = "会话名称", example = "项目计划讨论")
    private String name;
    
    /**
     * 会话访问令牌
     */
    @TableField("access_token")
    @Schema(description = "会话访问令牌", example = "abc123def456")
    private String accessToken;
    
    /**
     * 会话状态：0-关闭，1-活跃
     */
    @TableField("status")
    @Schema(description = "会话状态：0-关闭，1-活跃", example = "1")
    private Integer status;
    
    /**
     * 最大参与人数
     */
    @TableField("max_participants")
    @Schema(description = "最大参与人数", example = "10")
    private Integer maxParticipants;
    
    /**
     * 过期时间
     */
    @TableField("expired_at")
    @Schema(description = "过期时间", example = "2023-12-31T23:59:59")
    private LocalDateTime expiredAt;

    @Column(name = "created_at")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 修正月份MM和小时HH的大小写
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") // 修正时区写法
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2023-10-01T12:00:00")
    private LocalDateTime createdAt;

    @Column(name = "updated_at")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 修正月份MM和小时HH的大小写
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") // 修正时区写法
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2023-10-01T12:00:00")
    private LocalDateTime updatedAt;
} 